<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="MSThemeCompatible" content="Yes"/>
<meta http-equiv="X-UA-Compatible" content="IE=8"/>
<title>即时消息窗口</title>
<style type="text/css">
body,html{
	margin:0px;
	padding:0px;
	font-size:12px;
	font-family:微软雅黑, 宋体;
	width:100%;
	height:100%;
	overflow:hidden;
}
p,div,select,input{
	font-size:12px;
	font-family:微软雅黑, 宋体;
}
body{
	background:#F7F6F4 url(bg_bottom.gif) repeat-x 0px 100%;
}
#msgcontainer{
	position:absolute;
	width:100%;
	top:0px;
	bottom:136px;
	margin:0px auto;
	overflow:auto;
	background:transparent url(bg_top.gif) repeat-x 100% 0px;
}
#msgtoolbar{
	position:absolute;
	width:100%;
	height:30px;
	bottom:106px;
	margin:0px auto;
	overflow:auto;
	padding-left:4px;
}
#msgsend{
	position:absolute;
	width:100%;
	height:76px;
	bottom:30px;
	margin:0px auto;
	overflow:auto;
}
#footer{
	position:absolute;
	width:100%;
	height:30px;
	bottom:0px;
	margin:0px auto;
	overflow:hidden;
}
.msg{
	margin:2px 0px;
	padding:0px;
	line-height:22px;
}
.msg .dt{
	padding:0px 5px 0px 3px;
	font-weight:bold;
}
.msg .from{
	padding:0px;
	font-weight:bold;
}
.msg .body{
	clear:both;
	padding:0px 3px;
}
#msgcontainer .err{
	margin:2px 0px;
	padding:0px 0px 0px 3px;
	font-weight:bold;
	color:#333;
}
#msgcontainer .info{
	margin:2px 0px;
	padding:0px 0px 0px 3px;
	color:#333;
}
.msg p{
	margin:0px;
	padding:0px;
}
#msgtoolbar a{
	display:block;
	float:left;
	width:16px;
	height:16px;
	margin:9px 2px 0px 0px;
	background:transparent url(none) no-repeat 50% 50%;
}
#msgtoolbar a#font{
	background-image:url(font.gif);
}
#msgtoolbar a#emotion{
	background-image:url(emotion.gif);
}
#msgtoolbar a#file{
	background-image:url(file.gif);
}
#msgtoolbar a#history{
	background-image:url(history.gif);
}
#sendarea{
	position:absolute;
	height:98%;
	top:0px;
	left:4px;
	right:2px;
	border:1px outset #ccc;
	overflow:auto;
	overflow-x:hidden;
	padding:0px;
	background:#F7F6F4 none;
}
#sendarea p{
	margin:0px 2px;
	padding:0px;
}
#footer button{
	width:74px;
	padding-top:2px;
	margin-top:3px;
	margin-right:2px;
	float:right;
}
#footer #status{
	height:100%;
	line-height:30px;
	width:62%;
	float:left;
	text-indent:4px;
	overflow:hidden;
}
.fontpopup{
	position:absolute;
	display:none;
	width:310px;
	height:30px;
	z-index:100;
	overflow:hidden;
	background:#ece9d8 url(none);
	border:1px solid #ccc;
}
.fontpopup select{
	margin-top:5px;
	margin-left:4px;
	float:left;
}
#fontfamily{
	width:150px;
}
#fontsize{
	width:60px;
}
.fontpopup a{
	display:block;
	float:left;
	width:18px;
	height:18px;
	line-height:18px;
	margin-top:7px;
	margin-left:4px;
	text-align:center;
	color:blue;
	outline:none;
}
.fontpopup a.selected,.fontpopup a:hover{
	border:1px solid #333;
	width:16px;
	height:16px;
}
.fontpopup #bold{
	font-weight:bold;
}
.fontpopup #italic{
	font-style:italic;
}
.fontpopup #underline{
	text-decoration:underline;
}
.fontpopup #color{
	background:transparent url(colorpicker.gif) no-repeat 50% 50%;
}
.fontpopup #color:hover{
	border:0px solid #333;
	width:18px;
	height:18px;
}
.emotionpopup{
	position:absolute;
	display:none;
	width:192px;
	height:98px;
	z-index:101;
	overflow:hidden;
	background:#ece9d8 url(none);
	border:1px solid #ccc;
}
</style>
</head>
<body onclick="chatwin.toggleEmotion(false);">
<div id="msgcontainer"></div>
<div id="msgtoolbar">
	<a href="javascript:chatwin.toggleFont();" id="font" title="设置您发送的消息的字体颜色等"></a>
	<a href="javascript:chatwin.toggleEmotion();" id="emotion" title="插入表情"></a>
	<a href="#file" id="file" title="发送文件"></a>
	<a href="#history" id="history" title="查看历史记录"></a>
</div>
<div id="msgsend">
	<div id="sendarea" contenteditable="true"></div>
</div>
<div id="footer">
	<div id="status"></div>
	<button type="button" id="btnsend" onclick="chatwin.send();">发送</button>
	<button type="button" id="btnclose" onclick="chatwin.close();">关闭</button>
</div>
<div id="fontpopupid" class="fontpopup" style="display:none">
	<select id="fontfamily" onchange="chatwin.setFontFamily(this);">
		<option value="微软雅黑">微软雅黑</option>
		<option value="宋体">宋体</option>
		<option value="黑体">黑体</option>
		<option value="仿宋">仿宋</option>
		<option value="楷体">楷体</option>
		<option value="隶书">隶书</option>
		<option value="幼圆">幼圆</option>
		<option value="Arial">Arial</option>
		<option value="Comic Sans MS">Comic Sans MS</option>
		<option value="Courier New">Courier New</option>
		<option value="Georgia">Georgia</option>
		<option value="Lucida Sans Unicode">Lucida Sans Unicode</option>
		<option value="Tahoma">Tahoma</option>
		<option value="Times New Roman">Times New Roman</option>
		<option value="Trebuchet MS">Trebuchet MS</option>
		<option value="Verdana">Verdana</option>
	</select>
	<select id="fontsize" onchange="chatwin.setFontSize(this);">
		<option value="8">8</option>
		<option value="9">9</option>
		<option value="10">10</option>
		<option value="11">11</option>
		<option value="12">12</option>
		<option value="14">14</option>
		<option value="16">16</option>
		<option value="18">18</option>
		<option value="20">20</option>
		<option value="22">22</option>
	</select>
	<a href="javascript:chatwin.setFontWeight();" id="bold" title="切换粗体显示">B</a>
	<a href="javascript:chatwin.setFontStyle();" id="italic" title="切换斜体显示">I</a>
	<a href="javascript:chatwin.setTextDecoration();" id="underline" title="切换下划线显示">U</a>
	<a href="#pickcolor" id="color" title="选择颜色"></a>
</div>
<div id="emotionpopupid" class="emotionpopup" style="display:none"></div>
<script type="text/javascript" language="javascript">
var chatwin={
	IE6:(window.navigator.userAgent.indexOf('MSIE 6.0') != -1),
	msgcontainer:null,
	sendarea:null,
	sendbutton:null,
	status:null,
	exeFolderUrl:null,
	emotionUrl:null,
	serverUrlFileExt:'.jsp',
	font:null,
	emotion:null,
	file:null,
	history:null,
	sendMsgKey:'CTRL+ENTER',
	style:{'font-family':'微软雅黑','font-size':'12px','font-weight':'normal','text-decoration':'none','font-style':'normal','color':'#000000'},
	styleChanged:false,
	setStyle:function(p,v){
		chatwin.style[p]=v;
		chatwin.styleChanged=true;
		chatwin.sendarea.style.cssText=chatwin.getStyle();
		chatwin.setparam('setstyle');
	},
	getStyle:function(p,v){
		var s='';
		if(!chatwin.styleChanged) return s;
		for(var n in chatwin.style){
			s+=n+':'+chatwin.style[n]+';';
		}
		return s;
	},
	setFontFamily:function(o){
		if(!o || o.value=='') return;
		chatwin.setStyle('font-family',o.value);
	},
	setFontSize:function(o){
		if(!o || o.value=='') return;
		chatwin.setStyle('font-size',o.value+'px');
	},
	setFontWeight:function(o){
		if(!o) o=document.getElementById('bold');
		var selected=false;
		if(o.className==''){o.className='selected';selected=true;}
		else{o.className='';selected=false;}
		chatwin.setStyle('font-weight',selected?'bold':'normal');
	},
	setFontStyle:function(o){
		if(!o) o=document.getElementById('italic');
		var selected=false;
		if(o.className==''){o.className='selected';selected=true;}
		else{o.className='';selected=false;}
		chatwin.setStyle('font-style',selected?'italic':'normal');
	},
	setTextDecoration:function(o){
		if(!o) o=document.getElementById('underline');
		var selected=false;
		if(o.className==''){o.className='selected';selected=true;}
		else{o.className='';selected=false;}
		chatwin.setStyle('text-decoration',selected?'underline':'none');
	},
	setColor:function(v){
		chatwin.setStyle('color',v);
	},
	fontPopupId:'fontpopupid',
	toggleFont:function(){
		var el=document.getElementById(chatwin.emotionPopupId);
		if(el!=null) el.style.display='none';
		el=document.getElementById(chatwin.fontPopupId);
		if(el==null)return;
		var visible=(arguments.length>0?!arguments[0]:(el.style.display!='none'));
		el.style.bottom='130px';
		el.style.left='4px';
		el.style.display=(visible?'none':'block');
	},
	emotionPopupId:'emotionpopupid',
	emotionCount:0,
	toggleEmotion:function(){
		var el=document.getElementById(chatwin.fontPopupId);
		if(el!=null && arguments.length==0) el.style.display='none';
		el=document.getElementById(chatwin.emotionPopupId);
		if(el==null)return;
		var visible=(arguments.length>0?!arguments[0]:(el.style.display!='none'));
		el.style.bottom='130px';
		el.style.left='20px';
		el.style.display=(visible?'none':'block');
	},
	selectemotion:function(idx,src){
		chatwin.toggleEmotion(false);
		if(chatwin.sendarea==null) chatwin.sendarea=document.getElementById('sendarea');
		if(chatwin.sendarea.disabled) return;
		chatwin.sendarea.focus();
		var rng = document.selection.createRange();
		rng.pasteHTML('<img id="emotion_'+idx+'" src="'+src+'" height="24" width="24" alt=""/>');
		chatwin.sendarea.focus();
	},
	init:function(exeFolderUrl,emotionUrl,serverUrlFileExt,sendMsgKey){
		chatwin.msgcontainer=document.getElementById('msgcontainer');
		chatwin.sendarea=document.getElementById('sendarea');
		chatwin.sendbutton=document.getElementById('btnsend');
		chatwin.status=document.getElementById('status');
		chatwin.font=document.getElementById('font');
		chatwin.emotion=document.getElementById('emotion');
		chatwin.file=document.getElementById('file');
		chatwin.history=document.getElementById('history');
		chatwin.setstatus('等待消息');
		chatwin.exeFolderUrl=(exeFolderUrl?'res://'+exeFolderUrl.replace(/\//ig,'\\'):null);
		var resUrl=chatwin.exeFolderUrl+'/GIF/IDR_GIF_';
		
		var imgtop='url('+resUrl+'BG_TOP)';
		var imgbottom='url('+resUrl+'BG_BOTTOM)';
		document.body.style.backgroundImage=imgbottom;
		chatwin.msgcontainer.style.backgroundImage=imgtop;
		chatwin.font.style.backgroundImage='url('+resUrl+'FONT)';
		chatwin.emotion.style.backgroundImage='url('+resUrl+'EMOTION)';
		chatwin.file.style.backgroundImage='url('+resUrl+'FILE)';
		chatwin.history.style.backgroundImage='url('+resUrl+'HISTORY)';
		var el=document.getElementById('color');
		if(el!=null) el.style.backgroundImage='url('+resUrl+'COLORPICKER)';
		
		if(serverUrlFileExt) chatwin.serverUrlFileExt=serverUrlFileExt;
		chatwin.emotionUrl=emotionUrl;
		if(chatwin.emotionUrl){
			var script = document.createElement('script');
			script.type = 'text/javascript';
			script.onreadystatechange = function () {
				if (script.readyState == 'loaded' || script.readyState == 'complete') {
					script.onreadystatechange = null;
					var popel=document.getElementById(chatwin.emotionPopupId);
					if(popel==null) return;
					var baseUrl=chatwin.emotionUrl;
					if(baseUrl==null || baseUrl.length==0) baseUrl='http://www.tensosoft.com/tsim/theme/emotions/';
					for(var i=1;i<=chatwin.emotionCount;i++){
						var src=baseUrl+(i<10?'000':(i<100?'00':(i<1000)?'0':''))+i+'.gif';
						var a=document.createElement('a');
						a.href='javascript:chatwin.selectemotion('+i+',\''+src+'\');';
						var img=document.createElement('img');
						img.src=src
						img.alt='单击插入表情';
						img.border='0';
						img.height='24';
						img.width='24';
						a.appendChild(img);
						popel.appendChild(a);
					}
				}
			};
			script.src = chatwin.emotionUrl+'emotions'+chatwin.serverUrlFileExt+'?getcount.js';
			var hs=document.getElementsByTagName('head');
			if(hs!=null && hs.length>0) hs[0].appendChild(script);
			else document.body.appendChild(script);
		}
		
		if(chatwin.IE6){
			var h=document.body.offsetHeight;
			var w=document.body.offsetWidth;
			chatwin.msgcontainer.style.height=(h-30-76-30)+'px';
			chatwin.sendarea.style.width=(w-4-2)+'px';
		}
		if(sendMsgKey!=undefined && sendMsgKey!=null && sendMsgKey.length>0) chatwin.sendMsgKey=sendMsgKey;
		var fnku=function(evt){
			var e=(window.event||evt);
			if(e.keyCode!=13) return;
			var key=(e.ctrlKey?'CTRL+':'')+'ENTER';
			if(key==chatwin.sendMsgKey) chatwin.send();
		};
		if (document.body.addEventListener) document.body.addEventListener('keyup', fnku, false);
		else if (document.body.attachEvent) document.body.attachEvent('onkeyup', fnku);
	},
	builddisplaymsg:function(id,dt,from,body,cssText){
		var elmsg=document.createElement('p');
		if(chatwin.IE6) elmsg.setAttribute('className','msg');
		else elmsg.setAttribute('class','msg');
		elmsg.setAttribute('id',id);
		
		var eldt=document.createElement('span');
		if(chatwin.IE6) eldt.setAttribute('className','dt');
		else eldt.setAttribute('class','dt');
		eldt.innerHTML=dt;
		
		var elfrom=document.createElement('span');
		if(chatwin.IE6) elfrom.setAttribute('className','from');
		else elfrom.setAttribute('class','from');
		elfrom.innerHTML=from+'：';
		
		var elbody=document.createElement('div');
		if(chatwin.IE6) elbody.setAttribute('className','body');
		else elbody.setAttribute('class','body');
		if(cssText && cssText.length>0) elbody.style.cssText=cssText;
		elbody.innerHTML=body;
		
		elmsg.appendChild(eldt);
		elmsg.appendChild(elfrom);
		elmsg.appendChild(elbody);
		return elmsg;
	},
	display:function(id,dt,from,body){
		var cssText=(arguments.length>4?arguments[4]:null);
		var elmsg=chatwin.builddisplaymsg(id,dt,from,body,cssText);
		if(!elmsg) return;
		if(chatwin.msgcontainer==null) chatwin.msgcontainer=document.getElementById('msgcontainer');
		chatwin.msgcontainer.appendChild(elmsg);
		elmsg.scrollIntoView(false);
		return elmsg;
	},
	error:function(id,desc){
		if(desc==undefined || desc==null||desc.length==0) return;
		var el=document.createElement('p');
		if(chatwin.IE6) el.setAttribute('className','err');
		else el.setAttribute('class','err');
		el.setAttribute('id',id);
		el.innerHTML=desc;
		if(chatwin.msgcontainer==null) chatwin.msgcontainer=document.getElementById('msgcontainer');
		chatwin.msgcontainer.appendChild(el);
		el.scrollIntoView(false);
	},
	info:function(id,desc){
		if(desc==undefined || desc==null||desc.length==0) return;
		var el=document.createElement('p');
		if(chatwin.IE6) el.setAttribute('className','info');
		else el.setAttribute('class','info');
		el.setAttribute('id',id);
		el.innerHTML=desc;
		if(chatwin.msgcontainer==null) chatwin.msgcontainer=document.getElementById('msgcontainer');
		chatwin.msgcontainer.appendChild(el);
		el.scrollIntoView(false);
	},
	send:function(){
		var dtv=new Date().valueOf();
		chatwin.setparam('send'+dtv);
	},
	senddone:function(id,dt,t,v){
		chatwin.display(id,dt,t,v,chatwin.getStyle());
		chatwin.sendarea.innerHTML='';
	},
	enablesend:function(){
		chatwin.sendbutton.disabled=false;
		chatwin.sendarea.disabled=false;
		if(!(arguments.length==1 && arguments[0]===false)) chatwin.sendarea.innerHTML='';
		chatwin.setstatus('完毕');
	},
	disablesend:function(smsg){
		if(smsg) chatwin.setstatus(smsg);
		chatwin.sendbutton.disabled=true;
		chatwin.sendarea.disabled=true;
	},
	setstatus:function(txt){
		chatwin.status.innerHTML=txt;
	},
	removeftlink:function(lid){
		var el=document.getElementById('ftask_'+lid);
		if(el!=null) el.removeNode(true);
	},
	removeftprogress:function(lid){
		var el=document.getElementById('ftp_'+lid);
		if(el!=null) el.removeNode(true);
	},
	ftprogress:function(lid,p){
		var pp=getProgress({id:('p_'+lid),pid:('ftp_'+lid),imgUndone:chatwin.exeFolderUrl+'/PNG/IDR_PNG_P_GREY',imgDone:chatwin.exeFolderUrl+'/PNG/IDR_PNG_P_BLUE'});
		if(typeof(p)=='number') pp.processing((p<0?0:(p>100?100:p)));
	},
	chatHistoryFiles:null,
	currentHistoryIndex:-1,
	scrolltotop:function(){
		var els=chatwin.msgcontainer.childNodes;
		if(els!=null && els.length>0) els[0].scrollIntoView(true);
	},
	sethistoryfiles:function(arr/*文件名数组*/){
		if(!arr || arr.length==0) return;
		chatwin.chatHistoryFiles=arr.sort().reverse();
		chatwin.currentHistoryIndex=0;
		chatwin.setparam('history:'+chatwin.currentHistoryIndex+':'+chatwin.gethistorychatfn(chatwin.currentHistoryIndex));
	},
	gethistorychatfn:function(historyIdx){
		var fn=null;
		if(chatwin.chatHistoryFiles && chatwin.chatHistoryFiles.length && historyIdx<(chatwin.chatHistoryFiles.length)){
			fn=chatwin.chatHistoryFiles[historyIdx];
			if(fn && typeof(fn)=='string' && fn.length>0){
				fn=fn.replace('.dat','');
			}
		}
		return fn;
	},
	showhistory:function(arr/*聊天记录数组*/,historyIdx){
		try{
			if(!arr || arr.length==0) return;
			var o=null;
			var elmsg=null;
			var elmsgfirst=null;
			var displayFlag=false;
			for(var i=arr.length-1;i>=0;i--){
				o=arr[i];
				if(!o || typeof(o)!='object') continue;
				var id=o.id;
				if(!displayFlag){
					var el=document.getElementById(id);
					if(el!=null) continue;
					displayFlag=true;
				}
				elmsg=chatwin.builddisplaymsg(o.id,o.dt,o.cn,o.msg,o.style);
				if(!elmsg) continue;
				chatwin.msgcontainer.insertAdjacentElement('afterBegin',elmsg);
				if(elmsgfirst==null) elmsgfirst=elmsg;
			}
			var fn=chatwin.gethistorychatfn(historyIdx+1);
			if(fn && typeof(fn)=='string' && fn.length>0){
				chatwin.currentHistoryIndex=(historyIdx+1);
				fn=fn.replace('.dat','');
				var elp=document.createElement('p');
				if(chatwin.IE6) elp.setAttribute('className','info');
				else elp.setAttribute('class','info');
				elp.setAttribute('id','prevhistorychatfile');
				elp.innerHTML='<a href="#history:'+(chatwin.currentHistoryIndex)+':'+fn+'">更早的聊天记录：'+fn+'</a>';
				chatwin.msgcontainer.insertAdjacentElement('afterBegin',elp);
			}
	
			if(elmsgfirst!=null) elmsgfirst.scrollIntoView(false);
		}catch(e){alert('无法显示历史记录，请联系管理员！');}
	},
	setparam:function(v){
		var l=window.location+'';
		var pos=l.indexOf('#');
		if(pos>0) l=l.substr(0,pos);
		window.location=l+'#'+v;
	},
	close:function(){
		chatwin.setparam('close');
	}
};
function getStyle(){
	return chatwin.getStyle();
}
function progress(x){
	this.id=null;
	this.pid=null;
	this.imgUndone='../theme/images/grey.png';
	this.imgDone='../theme/images/blue.png';
	this.parts=[{weight:100,name:'正在传输...'}];
	this.showPartName=false;
	this.elstyle={'position':'relative','width':'200px','height':'20px','overflow':'hidden','border':' 1px solid #444','-webkit-border-radius':'5px','-moz-border-radius':'5px','background':'#656565 url(none) repeat-x top right'};
	this.elpstyle={'float':'left','width':'0%','height':'100%','background':'#6ba8e5 url(none) repeat-x top right'};
	this.eltstyle={'position':'absolute','left':'0px','top':'0px','z-index':'100','width':'100%','height':'100%','line-height':'20px','cursor':'default','font-weight':'bold','color':'#fff','text-align':'center'};
	this.inited=false;
	for(var n in x){
		var v=x[n];
		if(n==='parts'){this[n]=v;}
		else if(typeof(v)=='object' && (n==='elstyle' ||n==='elpstyle'||n==='eltstyle')){for(var n1 in v)this[n][n1]=v[n1];}
		else {this[n]=v;}
	}
	this.progressIdPostfix='_done';
	this.tipIdPostfix='_tip';
	this.IE6=(window.navigator.userAgent.indexOf('MSIE 6.0') != -1);
	this.el=null;
	this.elp=null;
	this.elt=null;
	this.el=document.getElementById(this.id);
	if(this.el!=null){
		this.elp=document.getElementById(this.id+this.progressIdPostfix);
		this.elt=document.getElementById(this.id+this.tipIdPostfix);
	}
	this.current=0;
	if(window._progresses==undefined){window._progresses={};}
	window._progresses[this.id]=this;
	this.inited=true;
	this._display();
}
progress.prototype._buildel=function(tag,id,style,innerHTML){
	var el=document.createElement(tag);
	el.setAttribute('id',id);
	var cssText='';
	for(var n in style){
		cssText+=(cssText.length==0?'':';')+n+':'+style[n];
	}
	if(typeof(el.getAttribute('style'))=='object') el.style.cssText=cssText;
	else el.setAttribute('style',cssText);
	if(typeof(innerHTML)=='string') el.innerHTML=innerHTML;
	return el;
}
progress.prototype._display=function(){
	if(this.el!=null) return;
	var pel=document.getElementById(this.pid);
	if(pel==null) return;
	this.el=this._buildel('div',this.id,this.elstyle,'');
	this.el.style.backgroundImage='url('+this.imgUndone+')';
	this.elp=this._buildel('div',this.id+this.progressIdPostfix,this.elpstyle,'');
	this.elp.style.backgroundImage='url('+this.imgDone+')';
	this.elt=this._buildel('div',this.id+this.tipIdPostfix,this.eltstyle,'dd');
	this.elp=this.el.appendChild(this.elp);
	this.elt=this.el.appendChild(this.elt);
	pel.appendChild(this.el);
}
progress.prototype.empty=function(){
	if(!this.inited) return;
	this.current=0;
	this.elp.style.width='0%';
	if(this.elt!=null) this.elt.innerHTML='';
}
progress.prototype.set=function(p,partIdx){
	try{
		if(!this.inited|| typeof(p)!='number'||isNaN(p)) return;
		if(p>100) p=100;
		if(p<0) p=0;
		if(this.current==p) return;
		this.elp.style.width=p+'%';
		this.current=p;
		if(this.elt!=null){
			var innerHTML=p+'%'+(this.showPartName&&typeof(partIdx)=='number'?' ,'+this.parts[partIdx].name:'');
			var t=document.createTextNode(innerHTML);
			this.elt.innerHTML='';
			this.elt.appendChild(t);
		}
	}catch(e){}
}
progress.prototype.processing=function(partPerVal,partIdx){
	if(!this.inited) return;
	if(partIdx==undefined ||partIdx==null||typeof(partIdx)!='number'||isNaN(partIdx)||partIdx<0 ||partIdx>=this.parts.length) partIdx=(this.parts.length-1);
	var part=this.parts[partIdx];
	var donePart=0;
	for(var i=0;i<partIdx;i++){
		donePart+=this.parts[i].weight;
	}
	if(typeof(partPerVal)!='number'||isNaN(partPerVal)||partPerVal<=0||partPerVal>100) return;
	var p=donePart+parseInt(part.weight*partPerVal/100);
	this.set(p,partIdx);
}
function getProgress(x){
	if(typeof(x)!='object'||typeof(x.id)!='string'||x.id.length==0){alert('必须提供必要的初始化参数！');return null;}
	var ret=null;
	if(typeof(window._progresses)=='object'){
		ret=window._progresses[x.id];
	}
	if(ret==null) ret=new progress(x);
	return ret;
}
//chatwin.init('','http://me.tensosoft.com/discoverx2/tsim/theme/emotions/');	//TODO:DELETE
//chatwin.info('ftp_test','正在发送文件...');
//chatwin.ftprogress('test',20);
</script>
</body>
</html>